<template>
  <div class="detail-base-info" v-if="Object.keys(goods).length !== 0">
    <div class="info-title">{{ goods.title }}</div>
    <div class="info-price">
      <span class="new-price">{{ goods.newPrice }}</span>
      <span class="old-price">{{ goods.oldPrice }}</span>
      <span class="discount" v-if="goods.discount">{{ goods.discount }}</span>
    </div>
    <div class="info-other">
      <span>{{ goods.columns[0] }}</span>
      <span>{{ goods.columns[1] }}</span>
      <span>{{ goods.services[goods.services.length - 1].name }}</span>
    </div>
    <div class="info-service">
      <span
        class="info-service-item"
        v-for="index in goods.services.length - 1"
        :key="index"
      >
        <img :src="goods.services[index].icon" alt="" />
        <span>{{ goods.services[index - 1].name }}</span>
      </span>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    goods: {
      type: Object,
    },
  },
};
</script>

<style lang="less" scoped>
.detail-base-info {
  padding: 15px 10px;
  .info-title {
    font-size: 18px;
    height: 60px;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-box-orient: vertical;
  }
  .info-price {
    .new-price {
      font-size: 25px;
      color: #ff5777;
    }
    .old-price {
      display: inline-block;
      margin: 0 5px;
      color: #999999;
      text-decoration: line-through;
    }
    .discount {
      display: inline-block;
      width: 50px;
      height: 20px;
      vertical-align: top;
      border-radius: 10px;
      background-color: #ff5777;
      text-align: center;
      line-height: 20px;
      color: #fff;
    }
  }
  .info-other {
    display: flex;
    justify-content: space-between;
    color: #999999;
    margin: 25px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(153, 153, 166, 0.3);
  }
  .info-service {
    display: flex;
    font-size: 14px;
    justify-content: space-between;
    padding-bottom: 30px;
    img {
      height: 16px;
    }
  }
}
</style>